<include file="Public/header" />
<include file="Public/menu" />
<link rel="stylesheet" href="/Public/admin/adminlte/bootstrap/css/bootstrap-switch.min.css">
<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            店铺配置
            <small>管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 店铺配置</a></li>
            <li class="active">快递单模板</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content"><div class="row"><div class="col-md-12"><div class="box">
        <div class="box-header">

            <div class="btn-group pull-left" style="margin-right: 10px">
                <a href="/Qgs/Delivery/Add" class="btn btn-sm btn-success"><i class="fa fa-save"></i>&nbsp;&nbsp;新增快递单模板</a>
            </div>

        </div>
        <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
            <table class="table table-hover">
                <tbody>
                <tr>
                    <th>ID</th>
                    <th>操作</th>
                    <th>是否启用</th>
                    <th>单据名称</th>
                </tr>
                <volist name="priter" id="priterInfo">
                    <tr>

                        <td>{$i}</td>
                        <td>
                            <a href="{:U('/Qgs/Delivery/Add',array('id'=>$priterInfo['prt_tmpl_id']))}"><i class="fa fa-edit"></i></a>
                            <a  href="javascript:void(0);" class="is_delete" data-id="{$priterInfo['prt_tmpl_id']}"><i class="fa fa-trash"></i></a>
                        </td>
                        <if condition="$priterInfo['shortcut'] eq 'true'">
                            <td>启用</td>
                            <else/>
                            <td>停止</td>
                        </if>
                        <td>{$priterInfo['prt_tmpl_title']}</td>

                    </tr>
                </volist>
                </tbody>
            </table>
        </div>


        <!-- /.box-body -->
    </div></div></div>

    </section>
</div>
<!-- 底部 -->
<include file="Public/common_footer" />
<script src="__PUBLIC__/admin/adminlte/bootstrap/js/bootstrap-switch.min.js"></script>


<script data-exec-on-popstate>



    $(function () {

        $('.is_delete').on('click',function () {
            $_this = $(this);
            if(confirm('确定删除该内容吗？')){
                // console.log($_this.parent().parent());
                $.ajax({
                    type:'post',
                    data:{'id':$_this.data('id')},
                    url:'/Qgs/Delivery/Delete',
                    success:function (data) {
                        if(data.status==1){
                            alert(data.msg);
                            $_this.parent().parent().remove();
                        }else{
                            alert(data.msg);
                        }
                    },
                    error:function () {
                        alert('参数错误');
                    }
                })

            }
        })

        /*$('.batch-delete').on('click', function() {
            var selected = [];
            $('.grid-item:checked').each(function(){
                selected.push($(this).data('id'));
            });

            if (selected.length == 0) {
                return;
            }

            if(confirm("Are you sure to delete this item ?")) {
                $.post('/Qgs/auth/roles/' + selected.join(), {_method:'delete','_token':'ALpaP7hXZ6s2dnAdE02Z6mUSHPt8RkYbcDRp6rpw'}, function(data){
                    $.pjax.reload('#pjax-container');
                    noty({
                        text: "<strong>Succeeded!</strong>",
                        type:'success',
                        timeout: 1000
                    });
                });
            }
        });*/
    });
</script>